package cn.stylefeng.guns.modular.actualLoadInformation.controller;

import cn.stylefeng.guns.modular.actualLoadInformation.entity.QyuanPowerSdGridActual;
import cn.stylefeng.guns.modular.actualLoadInformation.pojo.request.QyuanPowerSdGridActualRequest;
import cn.stylefeng.guns.modular.actualLoadInformation.service.QyuanPowerSdGridActualService;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 负荷信息实际信息表，记录每天96个时间点的电网运行实际数据控制器
 *
 * @author 我是谭先生🐻
 * @date 2025/03/14 09:09
 */
@RestController
@ApiResource(name = "负荷信息实际信息表，记录每天96个时间点的电网运行实际数据")
public class QyuanPowerSdGridActualController {

    @Resource
    private QyuanPowerSdGridActualService qyuanPowerSdGridActualService;

    /**
     * 添加
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 09:09
     */
    @PostResource(name = "添加", path = "/qyuanPowerSdGridActual/add")
    public ResponseData<QyuanPowerSdGridActual> add(@RequestBody @Validated(QyuanPowerSdGridActualRequest.add.class) QyuanPowerSdGridActualRequest qyuanPowerSdGridActualRequest) {
        qyuanPowerSdGridActualService.add(qyuanPowerSdGridActualRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 删除
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 09:09
     */
    @PostResource(name = "删除", path = "/qyuanPowerSdGridActual/delete")
    public ResponseData<?> delete(@RequestBody @Validated(QyuanPowerSdGridActualRequest.delete.class) QyuanPowerSdGridActualRequest qyuanPowerSdGridActualRequest) {
        qyuanPowerSdGridActualService.del(qyuanPowerSdGridActualRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 09:09
     */
    @PostResource(name = "编辑", path = "/qyuanPowerSdGridActual/edit")
    public ResponseData<?> edit(@RequestBody @Validated(QyuanPowerSdGridActualRequest.edit.class) QyuanPowerSdGridActualRequest qyuanPowerSdGridActualRequest) {
        qyuanPowerSdGridActualService.edit(qyuanPowerSdGridActualRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 查看详情
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 09:09
     */
    @GetResource(name = "查看详情", path = "/qyuanPowerSdGridActual/detail")
    public ResponseData<QyuanPowerSdGridActual> detail(@Validated(QyuanPowerSdGridActualRequest.detail.class) QyuanPowerSdGridActualRequest qyuanPowerSdGridActualRequest) {
        return new SuccessResponseData<>(qyuanPowerSdGridActualService.detail(qyuanPowerSdGridActualRequest));
    }

    /**
     * 获取列表
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 09:09
     */
    @GetResource(name = "获取列表", path = "/qyuanPowerSdGridActual/list")
    public ResponseData<List<QyuanPowerSdGridActual>> list(QyuanPowerSdGridActualRequest qyuanPowerSdGridActualRequest) {
        return new SuccessResponseData<>(qyuanPowerSdGridActualService.findList(qyuanPowerSdGridActualRequest));
    }

    /**
     * 获取列表（带分页）
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 09:09
     */
    @GetResource(name = "分页查询", path = "/qyuanPowerSdGridActual/page")
    public ResponseData<PageResult<QyuanPowerSdGridActual>> page(QyuanPowerSdGridActualRequest qyuanPowerSdGridActualRequest) {
        return new SuccessResponseData<>(qyuanPowerSdGridActualService.findPage(qyuanPowerSdGridActualRequest));
    }

}
